﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Hrm.Core
{
    public static class EncryptionTool
    {
        public static string getMd5(string userPwd)
        {
            //获取userPwd的byte类型数组
            byte[] byteUserPwd = Encoding.Default.GetBytes(userPwd);
            //实例化MD5CryptoServiceProvider
            MD5CryptoServiceProvider myMd5 = new MD5CryptoServiceProvider();
            // byte类型数组的值转换为 byte类型的Md5值
            byte[] byteMd5UserPwd = myMd5.ComputeHash(byteUserPwd);
            //将byte类型的Md5值转换为字符串
            string strMd5Pwd = Encoding.Default.GetString(byteMd5UserPwd).Trim();
            //返回Md5字符串
            return strMd5Pwd;
        }
    }
}
